﻿-- MySQL dump 10.13  Distrib 5.5.28, for Win64 (x86)
--
-- Host: localhost    Database: tcms
-- ------------------------------------------------------
-- Server version	5.5.28

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `my_aspnet_applications`
--

DROP TABLE IF EXISTS `my_aspnet_applications`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_applications` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(256) DEFAULT NULL,
  `description` varchar(256) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_applications`
--

LOCK TABLES `my_aspnet_applications` WRITE;
/*!40000 ALTER TABLE `my_aspnet_applications` DISABLE KEYS */;
INSERT INTO `my_aspnet_applications` VALUES (1,'/','MySQL Role provider');
/*!40000 ALTER TABLE `my_aspnet_applications` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `my_aspnet_membership`
--

DROP TABLE IF EXISTS `my_aspnet_membership`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_membership` (
  `userId` int(11) NOT NULL DEFAULT '0',
  `Email` varchar(128) DEFAULT NULL,
  `Comment` varchar(255) DEFAULT NULL,
  `Password` varchar(128) NOT NULL,
  `PasswordKey` char(32) DEFAULT NULL,
  `PasswordFormat` tinyint(4) DEFAULT NULL,
  `PasswordQuestion` varchar(255) DEFAULT NULL,
  `PasswordAnswer` varchar(255) DEFAULT NULL,
  `IsApproved` tinyint(1) DEFAULT NULL,
  `LastActivityDate` datetime DEFAULT NULL,
  `LastLoginDate` datetime DEFAULT NULL,
  `LastPasswordChangedDate` datetime DEFAULT NULL,
  `CreationDate` datetime DEFAULT NULL,
  `IsLockedOut` tinyint(1) DEFAULT NULL,
  `LastLockedOutDate` datetime DEFAULT NULL,
  `FailedPasswordAttemptCount` int(10) unsigned DEFAULT NULL,
  `FailedPasswordAttemptWindowStart` datetime DEFAULT NULL,
  `FailedPasswordAnswerAttemptCount` int(10) unsigned DEFAULT NULL,
  `FailedPasswordAnswerAttemptWindowStart` datetime DEFAULT NULL,
  PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='2';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_membership`
--

LOCK TABLES `my_aspnet_membership` WRITE;
/*!40000 ALTER TABLE `my_aspnet_membership` DISABLE KEYS */;
INSERT INTO `my_aspnet_membership` VALUES (1,'admin@demo.com','','R6Q5t0RGHjXvu2HJN31WP0t5jug0uLbeBh5Sr539Ro0=','qvsFuae9qTk7+F3hEE4dQQ==',1,NULL,NULL,1,'2012-11-15 23:01:02','2012-11-15 23:01:02','2012-10-13 00:20:25','2012-10-13 00:20:25',0,'2012-10-13 00:20:25',1,'2012-10-14 14:23:46',0,'2012-10-13 00:20:25'),(2,'manager@demo.com','','A7R3GJ9ipGGf23Xp08xNKB+crXaNMR3U0sMoqUtJ2ms=','dtwsT3ipRaysEFX4Gj59DA==',1,NULL,NULL,1,'2012-12-02 12:53:02','2012-12-02 12:53:02','2012-10-13 00:20:42','2012-10-13 00:20:42',0,'2012-10-13 00:20:42',0,'2012-10-13 00:20:42',0,'2012-10-13 00:20:42'),(3,'staff@demo.com','','ZmaX08V2KJX5ySqmauhQSqQEehxVQOBr9KgU5L1YjUE=','YXwV7Ifwslgd1SCQyes4Bw==',1,NULL,NULL,1,'2012-12-02 12:50:22','2012-12-02 12:50:22','2012-10-13 00:20:57','2012-10-13 00:20:57',0,'2012-10-13 00:20:57',1,'2012-10-27 00:37:52',0,'2012-10-13 00:20:57'),(4,NULL,'','cPPhdigC1Uk5aL/fE+rJDDU0kif4iwKxQwTUHyVr+2w=','/bA610++n0SQQCM+kSQWwQ==',1,NULL,NULL,1,'2012-10-27 13:53:39','2012-10-27 13:53:39','2012-10-27 13:53:24','2012-10-27 13:53:24',0,'2012-10-27 13:53:24',0,'2012-10-27 13:53:24',0,'2012-10-27 13:53:24'),(5,NULL,'','SjI6lXZZVVTZyoohfFApsuaVyu3QMa1T1QBKMeVEapY=','JMj1NOTuL3McIybk7Q9YQw==',1,NULL,NULL,1,'2012-11-10 10:16:53','2012-11-10 10:16:53','2012-11-10 10:16:53','2012-11-10 10:16:53',0,'2012-11-10 10:16:53',0,'2012-11-10 10:16:53',0,'2012-11-10 10:16:53'),(6,NULL,'','x1O5dnOO54lAYxP8ob8KU87vrBln546SP+C0IxuBfNU=','mdy6hjaIqYjvvbtTWptj1A==',1,NULL,NULL,1,'2012-11-10 10:25:11','2012-11-10 10:25:11','2012-11-10 10:24:27','2012-11-10 10:24:27',0,'2012-11-10 10:24:27',0,'2012-11-10 10:24:27',0,'2012-11-10 10:24:27'),(7,NULL,'','qoPrRckCMdn+aYRCV00TxQslzNC36LIOYV+F2giWpRo=','l2Zw70/AUM6dSfu3g3FI/g==',1,NULL,NULL,1,'2012-11-10 22:30:50','2012-11-10 22:30:50','2012-11-10 22:30:35','2012-11-10 22:30:35',0,'2012-11-10 22:30:35',0,'2012-11-10 22:30:35',0,'2012-11-10 22:30:35');
/*!40000 ALTER TABLE `my_aspnet_membership` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `my_aspnet_profiles`
--

DROP TABLE IF EXISTS `my_aspnet_profiles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_profiles` (
  `userId` int(11) NOT NULL,
  `valueindex` longtext,
  `stringdata` longtext,
  `binarydata` longblob,
  `lastUpdatedDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_profiles`
--

LOCK TABLES `my_aspnet_profiles` WRITE;
/*!40000 ALTER TABLE `my_aspnet_profiles` DISABLE KEYS */;
/*!40000 ALTER TABLE `my_aspnet_profiles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `my_aspnet_roles`
--

DROP TABLE IF EXISTS `my_aspnet_roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_roles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `applicationId` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_roles`
--

LOCK TABLES `my_aspnet_roles` WRITE;
/*!40000 ALTER TABLE `my_aspnet_roles` DISABLE KEYS */;
INSERT INTO `my_aspnet_roles` VALUES (3,1,'admin'),(4,1,'manager'),(5,1,'staff');
/*!40000 ALTER TABLE `my_aspnet_roles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `my_aspnet_schemaversion`
--

DROP TABLE IF EXISTS `my_aspnet_schemaversion`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_schemaversion` (
  `version` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_schemaversion`
--

LOCK TABLES `my_aspnet_schemaversion` WRITE;
/*!40000 ALTER TABLE `my_aspnet_schemaversion` DISABLE KEYS */;
INSERT INTO `my_aspnet_schemaversion` VALUES (7),(7);
/*!40000 ALTER TABLE `my_aspnet_schemaversion` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `my_aspnet_sessioncleanup`
--

DROP TABLE IF EXISTS `my_aspnet_sessioncleanup`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_sessioncleanup` (
  `LastRun` datetime NOT NULL,
  `IntervalMinutes` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_sessioncleanup`
--

LOCK TABLES `my_aspnet_sessioncleanup` WRITE;
/*!40000 ALTER TABLE `my_aspnet_sessioncleanup` DISABLE KEYS */;
INSERT INTO `my_aspnet_sessioncleanup` VALUES ('2012-10-16 20:44:57',10),('2012-10-13 00:18:42',10);
/*!40000 ALTER TABLE `my_aspnet_sessioncleanup` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `my_aspnet_sessions`
--

DROP TABLE IF EXISTS `my_aspnet_sessions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_sessions` (
  `SessionId` varchar(255) NOT NULL,
  `ApplicationId` int(11) NOT NULL,
  `Created` datetime NOT NULL,
  `Expires` datetime NOT NULL,
  `LockDate` datetime NOT NULL,
  `LockId` int(11) NOT NULL,
  `Timeout` int(11) NOT NULL,
  `Locked` tinyint(1) NOT NULL,
  `SessionItems` longblob,
  `Flags` int(11) NOT NULL,
  PRIMARY KEY (`SessionId`,`ApplicationId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_sessions`
--

LOCK TABLES `my_aspnet_sessions` WRITE;
/*!40000 ALTER TABLE `my_aspnet_sessions` DISABLE KEYS */;
/*!40000 ALTER TABLE `my_aspnet_sessions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `my_aspnet_users`
--

DROP TABLE IF EXISTS `my_aspnet_users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `applicationId` int(11) NOT NULL,
  `name` varchar(256) NOT NULL,
  `isAnonymous` tinyint(1) NOT NULL DEFAULT '1',
  `lastActivityDate` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_users`
--

LOCK TABLES `my_aspnet_users` WRITE;
/*!40000 ALTER TABLE `my_aspnet_users` DISABLE KEYS */;
INSERT INTO `my_aspnet_users` VALUES (1,1,'admin',0,'2012-11-15 23:01:02'),(2,1,'manager',0,'2012-12-02 12:53:02'),(3,1,'staff',0,'2012-12-02 12:50:22'),(4,1,'admin1',0,'2012-10-27 13:53:39'),(5,1,'sdddf',0,'2012-11-10 10:16:53'),(6,1,'newcomer',0,'2012-11-10 10:25:11'),(7,1,'songs',0,'2012-11-10 22:30:50');
/*!40000 ALTER TABLE `my_aspnet_users` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `my_aspnet_usersinroles`
--

DROP TABLE IF EXISTS `my_aspnet_usersinroles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `my_aspnet_usersinroles` (
  `userId` int(11) NOT NULL DEFAULT '0',
  `roleId` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`userId`,`roleId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `my_aspnet_usersinroles`
--

LOCK TABLES `my_aspnet_usersinroles` WRITE;
/*!40000 ALTER TABLE `my_aspnet_usersinroles` DISABLE KEYS */;
INSERT INTO `my_aspnet_usersinroles` VALUES (1,3),(2,4),(3,5),(4,4),(5,5),(6,4),(7,4);
/*!40000 ALTER TABLE `my_aspnet_usersinroles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `shopfloors`
--

DROP TABLE IF EXISTS `shopfloors`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shopfloors` (
  `id` char(36) NOT NULL,
  `shopName` varchar(45) NOT NULL,
  `status` int(11) DEFAULT NULL,
  `Xposition` int(11) DEFAULT NULL,
  `Yposition` int(11) DEFAULT NULL,
  `Icon` varchar(255) DEFAULT NULL,
  `remark` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `shopfloors`
--

LOCK TABLES `shopfloors` WRITE;
/*!40000 ALTER TABLE `shopfloors` DISABLE KEYS */;
INSERT INTO `shopfloors` VALUES ('09E3F4CC-A491-20B0-AE03-5B44A6783827','C111',NULL,418,619,'ICON_00.png',''),('1B48C24F-5871-0AC4-D25E-7BAF3EF94826','A130',1,834,375,'ICON_00.png',''),('23B83314-2F4A-48B2-F6E2-730EB1A73969','E100',NULL,623,605,'ICON_00.png',''),('2F3302CB-8377-DBDB-7EA7-1C6BDD56AAE6','C106',NULL,825,686,'ICON_00.png',''),('37EC1483-8594-A069-F84B-4FE1873A3FB8','C108',NULL,818,604,'ICON_00.png',''),('3D2029D1-2C93-A42D-F1BD-39D11378F76B','A104',0,719,459,'ICON_00.png',''),('3E8AF259-34BE-34A3-520C-AE46B646F12D','E101',NULL,513,685,'ICON_00.png',''),('414C6CFA-9BF2-F532-055F-A2BF518E778D','D100',NULL,258,686,'ICON_00.png',''),('49937410-7EEB-4B2B-F1B8-9CA10EC73ACC','C107',NULL,728,682,'ICON_00.png',''),('55BC5916-FC3D-6F0F-D031-4BC70F75FC02','炸药车间',NULL,258,765,'ICON_00.png',''),('5647B653-48FA-67A3-DAF3-46BD78D1AB9A','D166',NULL,431,940,'ICON_00.png',''),('5ED7FB3E-36ED-35AF-4134-AA8857AEDF51','A126',1,167,467,'ICON_00.png',''),('6B30A437-A51D-8EFF-3E40-5650506567AE','A121',1,264,530,'ICON_00.png',''),('6CEE77A7-A879-C4F1-8D73-521C8856A134','A127',NULL,98,533,'ICON_00.png',''),('72A6977E-AC35-96DB-3CE2-4BEC6B8D82CF','A132',NULL,637,459,'ICON_00.png',''),('7D6D1DD9-EED7-818F-FCA9-834BF5849820','A128',NULL,635,374,'ICON_00.png',''),('7DBB1D49-0885-DE7D-F840-479D82605654','A131',NULL,506,461,'ICON_00.png',''),('8C4B06C7-9920-2939-0F96-BFDDC0A252E3','B111',NULL,557,175,'ICON_01.png','this is remark'),('927E9385-1A92-4AB0-3A96-8F7ED63DE08F','A125',NULL,414,535,'ICON_00.png',''),('936DA01F-9ABD-4d9d-80C7-02AF85C822A8','A102',1,804,531,'ICON_00.png',''),('9EE38058-F38C-FF96-F31E-53421C24F23F','C100',NULL,174,606,'ICON_00.png',''),('A053ED0D-611A-061B-D27D-26AECA82E8D0','C102',NULL,262,613,'ICON_00.png',''),('A36FF56A-9319-3FFE-D2D1-C45506722A9D','E102',NULL,623,688,'ICON_00.png',''),('ACFF5CE5-A03F-04E0-26BA-B49AA7264043','A123',NULL,411,467,'ICON_00.png',''),('AFC7686E-67BE-8E41-97FB-56CC2A674BA7','C105',NULL,88,765,'ICON_00.png',''),('B4E6177A-D7BD-F75E-A895-96B8A45471D7','C109',NULL,725,603,'ICON_00.png',''),('CE3B51F0-B2E1-CB3C-4D87-39BB6924CACD','B182',1,404,692,'ICON_00.png',''),('D2E3BF2F-F886-2576-0430-249F227DB351','兵器房',NULL,405,770,'ICON_00.png',''),('D653B7AD-65BB-12E8-6AED-9CC5E2053D05','A103',0,837,459,'ICON_00.png',''),('D654B8B8-7B08-CFBB-A34E-16898CC9CFE7','C103',NULL,816,934,'ICON_00.png',''),('D937B198-1116-827B-CAFB-898F768E6CA6','火炮车间',NULL,62,894,'ICON_00.png',''),('E6F07CD0-514C-E492-E725-5D677B643875','A124',NULL,509,529,'ICON_00.png',''),('E93F8C01-4DC1-D2DC-3C17-8CDA3BDE32E9','C110',NULL,508,608,'ICON_00.png',''),('F1EC488E-58A8-A7F7-C813-3D6000B0286D','A129',NULL,722,376,'ICON_00.png',''),('F27C9737-DFE8-4A43-13E8-29E5E25307E3','火药房',NULL,311,952,'ICON_00.png',''),('F34A9DD0-0B82-6063-4889-E6B99C4D2709','A122',1,261,459,'ICON_00.png',''),('F6245BEF-4B64-DFA3-D590-E11144F5FFB6','C104',NULL,822,763,'ICON_00.png',''),('F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4','A101',0,264,997,'ICON_00.png',''),('FB175679-6A8D-B92A-61E4-0AE2208A0B42','A125',NULL,638,525,'ICON_00.png',''),('FD6D52FB-EDEB-6494-AE5E-7ACD69A52DAD','火箭车间',NULL,251,884,'ICON_00.png','');
/*!40000 ALTER TABLE `shopfloors` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tasks`
--

DROP TABLE IF EXISTS `tasks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tasks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) DEFAULT NULL,
  `shopName` varchar(45) DEFAULT NULL,
  `productName` varchar(45) DEFAULT NULL,
  `status` int(2) DEFAULT NULL,
  `batch` varchar(45) DEFAULT NULL,
  `startTime` datetime DEFAULT NULL,
  `endTime` datetime DEFAULT NULL,
  `dangerousProducts` varchar(200) DEFAULT NULL,
  `dangerousProcedure` varchar(200) DEFAULT NULL,
  `inPopulating` int(11) DEFAULT NULL,
  `department` varchar(45) DEFAULT NULL,
  `team` varchar(45) DEFAULT NULL,
  `teamLeader` varchar(45) DEFAULT NULL,
  `teamSafety` varchar(45) DEFAULT NULL,
  `departSafety` varchar(45) DEFAULT NULL,
  `teamTel` varchar(45) DEFAULT NULL,
  `createBy` varchar(256) DEFAULT NULL,
  `createTime` datetime DEFAULT NULL,
  `remark` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tasks`
--

LOCK TABLES `tasks` WRITE;
/*!40000 ALTER TABLE `tasks` DISABLE KEYS */;
INSERT INTO `tasks` VALUES (13,'test','A130','tseasf',1,'X1000','2012-12-02 00:00:00','2012-12-03 00:00:00','dfasdsf','dfafdsfa',1000,'test','test','teasdgf','asdfsa','dfadfjsa;jf','fddasf','staff','2012-12-02 12:51:24','afdsadfsaf');
/*!40000 ALTER TABLE `tasks` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Dumping events for database 'tcms'
--
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
/*!50106 DROP EVENT IF EXISTS `update_status_test` */;
DELIMITER ;;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
/*!50003 SET character_set_client  = utf8 */ ;;
/*!50003 SET character_set_results = utf8 */ ;;
/*!50003 SET collation_connection  = utf8_general_ci */ ;;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone      = @@time_zone */ ;;
/*!50003 SET time_zone             = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `update_status_test` ON SCHEDULE EVERY 1 SECOND STARTS '2012-12-02 12:31:21' ON COMPLETION PRESERVE ENABLE DO call update_status_task_shop() */ ;;
/*!50003 SET time_zone             = @saved_time_zone */ ;;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;;
/*!50003 SET character_set_client  = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection  = @saved_col_connection */ ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;

--
-- Dumping routines for database 'tcms'
--
/*!50003 DROP PROCEDURE IF EXISTS `add_new_task` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection  = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `add_new_task`(
IN shop_name varchar(45), 
IN start_date datetime, 
IN end_date datetime)
begin  
      declare endDay datetime;
      declare startDay datetime;
      declare done int;
      declare cur_addtask CURSOR for select startTime,endTime from tcms.tasks where shopName=shop_name; 
      declare continue handler FOR NOT FOUND SET done=1;
		set done=0;
	  
 
	  open cur_addtask;
	  fetchsqlloop:loop
	  
if done then
		select 0;
		leave fetchsqlloop;
else
		fetch cur_addtask into startDay, endDay;
      if endDay>=now() then  
		 
			if start_date>endDay or end_date<startDay then

					select 0;
					
			else
					select 1;
					leave fetchsqlloop;
			end  if;

	  end if;
end if;
end loop;
        close cur_addtask;

end */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `update_status_task_shop` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection  = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `update_status_task_shop`()
begin  
      declare endDay datetime;
      declare startDay datetime;
	   declare id_current int;
	   declare shop varchar(45);
	   declare shop_old varchar(45);
      declare done int;
      declare cur_taskstatus CURSOR for select id,shopName,startTime,endTime from tcms.tasks where status<>0;        
      declare cur_shopstatus CURSOR for select shopName from tcms.tasks where status=1; 
      declare continue handler FOR NOT FOUND SET done=1;
		set done=0; 	  
 
	  open cur_taskstatus;
	  fetchsqlloop:loop
	  
if done then
		leave fetchsqlloop;
else
		fetch cur_taskstatus into id_current,shop_old,startDay, endDay;

		if endDay<now() then  		
			update tcms.tasks set status=0 where id=id_current;
			update tcms.shopfloors set status=0 where shopname=shop_old;

		elseif startDay<=now() and endDay>=now() then
			update tcms.tasks set status=1 where id=id_current;

		elseif startDay>now() then
			update tcms.tasks set status=2 where id=id_current;		
	
		end if;
end if;
end loop;
        close cur_taskstatus;

set done = 0;

	  open cur_shopstatus;
	  fetchsqlloop:loop
	  
if done then
		leave fetchsqlloop;
else
		fetch cur_shopstatus into shop;

		update shopfloors set status=1 where shopName=shop;	
	
end if;
end loop;
        close cur_shopstatus;
end */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2012-12-02 13:07:23
